using System;
using System.Collections.Generic;
using System.Text;

namespace ca.metaobjects.csogateway
{
	/// <summary>
	/// An expected exception in the CSO Gateway.
	/// </summary>
    public class CsoGatewayException : Exception
    {
        /// <summary>
		/// Initializes a new instance of the <see cref="CsoGatewayException"/> class.
        /// </summary>
		internal CsoGatewayException()
			: base()
		{
		}

        /// <summary>
		/// Initializes a new instance of the <see cref="CsoGatewayException"/> class
        /// with a specified error message.
        /// </summary>
		/// <param name="eMessage">The error message that explains the reason for the exception.</param>
		/// <param name="stringArgs">Array of string filling error message missing parts.</param>
		internal CsoGatewayException(ExceptionMessage eMessage, params string[] stringArgs)
			: base("[" + eMessage.id + "] " + String.Format(eMessage.message, stringArgs))
		{
		}

        /// <summary>
		/// Initializes a new instance of the <see cref="CsoGatewayException"/> class
        /// with a specified error message and a reference to the inner exception that is the cause of this exception.
        /// </summary>
		/// <param name="eMessage">The error message that explains the reason for the exception.</param>
        /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
		/// <param name="stringArgs">Array of string filling error message missing parts.</param>
		internal CsoGatewayException(ExceptionMessage eMessage, Exception innerException, params string[] stringArgs)
			: base("[" + eMessage.id + "] " + String.Format(eMessage.message, stringArgs), innerException)
        {
        }
    }
}
